package com.atguigu.spzx.manager.service.impl;

import com.atguigu.spzx.manager.mapper.ProductSpecMapper;
import com.atguigu.spzx.manager.service.ProductSpecService;
import com.atguigu.spzx.model.entity.product.ProductSpec;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * title:
 * author: zgl
 * date: 2024/1/5
 * description：
 */
@Service
public class ProductSpecServiceImpl implements ProductSpecService {
    @Autowired
    private ProductSpecMapper productSpecMapper;

    @Override
    public List<ProductSpec> allProductSpec() {
        return productSpecMapper.list();
    }

    @Override
    public PageInfo<ProductSpec> list(Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<ProductSpec> list = productSpecMapper.list();
        return new PageInfo<>(list);
    }

    @Override
    public void deleteSpec(Long id) {
        productSpecMapper.deleteSpec(id);
    }

    @Override
    public void saveSpec(ProductSpec productSpec) {
        productSpecMapper.saveSpec(productSpec);
    }

    @Override
    public void updateSpec(ProductSpec productSpec) {
        productSpecMapper.updateSpec(productSpec);
    }
}
